/*** 
 * @Author: pengcheng
 * @Date: 2021-06-24 17:17:54
 * @LastEditTime: 2021-08-24 17:48:59
 * @LastEditors: pengcheng
 * @Description: 
 * @FilePath: /kylin-daq/src/LogControl.cpp
 */
#include "LogControl.h"

QScopedPointer<LogControl> LogControl::ms_instance;
LogControl *LogControl::instance()
{
    if (ms_instance.isNull()) {
        ms_instance.reset(new LogControl());
    }
    return ms_instance.data();
}

LogControl::LogControl()
{
}

void LogControl::init(const QString strAppName)
{
    instance()->doInit(strAppName);
}

LogControl::~LogControl()
{

}

void LogControl::doInit(const QString strAppName)
{
    LogCheck::instance()->init(strAppName);
    LogRecord::instance()->init(strAppName);
    state = LogControlState::Run;
}

void LogControl::exit()
{
    instance()->doExit();
}

void LogControl::doExit()
{
    LogCheck::instance()->exit();
    LogCheck::instance()->wait();
    state = LogControlState::Exit;
}

LogControl::LogControlState LogControl::status()
{
    return instance()->doStatus();
}

LogControl::LogControlState LogControl::doStatus()
{
    return state;
}

